package com.litxuf.web.action.front;

import org.apache.log4j.Logger;
import org.apache.struts.action.Action;

import com.litxuf.logic.core.ManagerFactory;
import com.litxuf.logic.member.manager.MemberManager;

public class FindMemberPWDAction extends Action {
	MemberManager manager = ManagerFactory.getFactory().getMemberManager();
	Logger log = Logger.getLogger(this.getClass().getName());

	 
//	public ActionForward execute(ActionMapping mapping, ActionForm form,
//			HttpServletRequest request, HttpServletResponse response)throws IOException {
//		request.setCharacterEncoding("utf-8");
//		String username = request.getParameter("username");
//		log.info("==>user=" + username);
//		String result="";
//		if (StringUtils.isBlank(username)) {
//			log.info("--> 用户名不能为空");
//			result="用户名不能为空";
//		} else {
//
//			School u = manager.findIsContainMemberName(username.toLowerCase());
//			if (u==null) {
//				log.info("-->"+username+" 系统中没有这个邮箱请重新输入你的注册邮箱");
//				result="系统中没有这个邮箱请重新输入你的注册邮箱";
//			} else {
//			 
//				String pwd=StringTools.getRandomPwd();
//				log.info("==>user=" + username + " 新密码 :"+pwd);
//				//1.重置密码
//				u.setMemberPwd(pwd);
//				manager.modifySoumlMember(u);
//				
//				//2.发送邮件
//				JavaMailSend send=ManagerFactory.getFactory().getJavaMailSend();
//				try {
//					send.sendfindPWDMail(username, pwd,username);
//					log.info("==>user=" + username + "--> 发送修改密码 邮件成功");
//					result="新密码已发送到你的邮箱 请查收";
//				} catch (MessagingException e1) {
//					e1.printStackTrace();
//				}
//			}
//		}
//		request.setAttribute("result", result);
//		request.setAttribute("username", username);
//		 
//		return mapping.findForward("findpwd");
//	}
}
